// Letter Spacing example
// This example shows how to add n number of spaces in-between the letters in a string
// By Ben 07/10/2018

#include <iostream>
#include <time.h>
using namespace std;

string Space(int length){
	//Make a string of n length that consists of only spaces.
	string s0 = "";
	for (int i = 0; i < length; i++){
		s0.append(" ");
	}
	return s0;
}

void LetterSpaceing(string &source, int size){
	string buff = "";
	
	for (int i = 0; i < source.length(); i++){
		//If char is not a space add in n number of spaces
		if (!isspace(source[i])){
			buff += source[i];
			//Append spaces
			buff.append(Space(size));
		}
	}
	source = buff;
}

int main(){

	string s0 = "C++ Programming is fun";
	//Add space between the letters.
	LetterSpaceing(s0, 2);
	std::cout << s0.c_str() << endl;
	system("pause");
	return 0;
}